//
//  GiftButton.m
//  GameBaby
//
//  Created by keyZhang on 14-1-6.
//  Copyright (c) 2014年 keyZhang. All rights reserved.
//

#import "GiftButton.h"


@interface GiftButton ()
{
    UIImageView *_lingImgView;
    UIImageView *_taoImgView;
}

@end

@implementation GiftButton

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self _initsView];
    }
    return self;
}



- (void)_initsView
{
    _lingImgView = [[UIImageView alloc] initWithFrame:CGRectMake(235, 8, 25, 23)];
    _taoImgView = [[UIImageView alloc] initWithFrame:CGRectMake(265, 8, 25, 23)];
    
    [self addSubview:_lingImgView];
    [self addSubview:_taoImgView];
    
    [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
}


- (void)setIsRedBg:(BOOL)isRedBg
{
    self.width = 300;
    self.height = 40;
    if (isRedBg) {
        [self setBackgroundImage:[UIImage imageNamed:@"nx2_08.png"] forState:UIControlStateNormal];
    }else
    {
        [self setBackgroundImage:[UIImage imageNamed:@"hxx2.png"] forState:UIControlStateNormal];
    }
}

- (void)setHasLing:(BOOL)hasLing
{
    if (hasLing) {
        _lingImgView.image = [UIImage imageNamed:@"oo_13.png"];
    }else
    {
        _lingImgView.image = [UIImage imageNamed:@"oo_13h.png"];
    }
}

- (void)setHasTao:(BOOL)hasTao
{
    if (hasTao) {
        _taoImgView.image = [UIImage imageNamed:@"oo_15.png"];
    }else
    {
        _taoImgView.image = [UIImage imageNamed:@"oo_15h.png"];
    }
}

- (void)setBtnTitle:(NSString *)btnTitle
{
    [self setTitle:[NSString stringWithFormat:@"   %@",btnTitle] forState:UIControlStateNormal];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
